< previous page page_646 next page >

Page 646
Table 16.6. EquipSupplier and DeptSupplier tables.
EquipSupplierDeptSupplier
EquipIDDeptID
SupplierIDSupplierID

These two tables are short because they are only needed to enforce expressed simple relationships between existing data tables. Creating small tables such as these is a handy way to reduce complex relationships to more straightforward ones. It is easier to create meaningful CONSTRAINT clauses when the tables are kept simple, too. The SQL DDL statements for these two tables appear in Listing 16.9. The result of executing these statements in Visdata appears in Figure 16.8.
0646-01.jpg
Figure 16.8.
EquipSupplier and DeptSupplier tables.
Type.gifListing 16.9. Creating the EquipSupplier and DeptSupplier tables.
CREATE TABLE EquipSupplier
   (EquipID TEXT(10),
    SupplierID TEXT(10),
    CONSTRAINT PKEqSpl PRIMARY KEY (EquipID,SupplierID),
    CONSTRAINT FKEqSplEquip FOREIGN KEY (EquipID)
       REFERENCES Equipment(EquipID),
    CONSTRAINT FKEqSplSupplier FOREIGN KEY (SupplierID)

 
< previous page page_646 next page >

If you like this book, buy it!